% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_distance_cdf_by_group.R
\name{plot_distance_cdf_by_group}
\alias{plot_distance_cdf_by_group}
\title{alias for distance_by_group_plot}
\usage{
plot_distance_cdf_by_group(
  results_bybg_people = NULL,
  radius_miles =
    round(max(results_bybg_people$distance_min_avgperson[!is.infinite(results_bybg_people$distance_min_avgperson)],
    na.rm = T), table_rounding_info("distance_min_avgperson")),
  subgroups_type = NULL,
  demogvarname = NULL,
  demoglabel = NULL,
  colorlist = colorspace::diverging_hcl(length(demogvarname)),
  coloroverall = "black",
  returnwhat = "table",
  ...
)
}
\arguments{
\item{results_bybg_people}{data.table from doaggregate()$results_bybg_people}

\item{radius_miles}{miles radius that was max distance analyzed}

\item{subgroups_type}{optional, can be set to "nh" or "alone".
Specifies types of race ethnicity subgroups to use for demogvarname
but only if demogvarname is not specified as a parameter.
If neither is specified it tries to use default_subgroups_type
if that is a variable set by global.R, since it cannot check the reactive variable input$subgroups_type
outside the context of the web app.}

\item{demogvarname}{optional way to specify names of columns to use from results_bybg_people,
e.g., c("pctlowinc", "pctmin"), or  namez$d, or
could be a vector of subgroups such as namez$d_subgroups_nh that includes "pctnhba" etc.
or namez$d_subgroups_alone that includes "pctba" etc.,
but if demogvarname is not specified here as a parameter,
this info could also be specified by the subgroups_type parameter here.
If neither is specified, the function will try to use a default}

\item{demoglabel}{friendly text names for labelling graphic, like "Low income residents"}

\item{colorlist}{colors like "red" etc. for the demographic groups of interest}

\item{coloroverall}{color like "gray" for everyone as a whole}

\item{returnwhat}{If returnwhat is "table", invisibly returns a
full table of sorted distances of blockgroups,
cumulative count of demog groups at that block group's distance.
If returnwhat is "plotfilename" then it returns the full path including filename of a .png in a tempdir
If returnwhat is "plot" then it returns the plot object as needed for table_xls_format()}

\item{...}{other parameters passed through to \code{\link[=points]{points()}}}
}
\value{
see \code{\link[=distance_by_group_plot]{distance_by_group_plot()}}
}
\description{
SLOW / needs to be optimized.
CDF Line Plots of cumulative share of each demographic group, within each distance
}
\examples{
 y <- ejamit(testpoints_100, radius = 3)
 
 # see barplot and table comparing groups to see which are closer to sites analyzed
 plot_distance_mean_by_group(y$results_bybg_people) # or distance_mean_by_group() synonym
 
 # table - proximity of sites for just one demog group vs rest of population
 print(distance_by_group(y$results_bybg_people,
   demogvarname = 'pctlowinc'))
   
 # plot cumulative share of group by distance vs overall population
  distance_by_group_plot(y$results_bybg_people,
     demogvarname = 'pctlowinc' )
     
 # plot cum. shares for two groups  
 # about 14\% of black and 12\% of asian residents have a site within 1 mile. 
 # 29\% vs 21\% have a site within 1.5 miles.
 round(xyz[findInterval(c(1, 1.5),  xyz$dist), ], 3) 
 
 # plot is too busy for all groups at once so this is a way to tap through them 1 by 1
 these = c(names_d, names_d_subgroups)
 for (i in 1:length(these)) {
   readline("press any key to see the next plot")
   print(distance_by_group_plot(y$results_bybg_people, demogvarname = these[i]) )
 }
 

}
\seealso{
\code{\link[=distance_by_group]{distance_by_group()}} \code{\link[=ejamit]{ejamit()}} for examples
}
